Don't require Cargo.toml for `cargo yank`
authorAlex Crichton <alex@alexcrichton.com>
Fri, 9 Jan 2015 23:33:35 +0000 (15:33 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 9 Jan 2015 23:34:33 +0000 (15:34 -0800)
Same fix as #923.

Closes #1138

src/bin/yank.rs
src/cargo/ops/registry.rs
src/cargo/sources/git/utils.rs

index a0e78907215cbf82c67d65059fc7cfecc4a8a8b8..e79deabe74bdfadc4e14f9250666b8804faf6039 100644 (file)
@@ -1,7 +1,6 @@
 use cargo::ops;
 use cargo::core::MultiShell;
 use cargo::util::{CliResult, CliError};
-use cargo::util::important_paths::find_root_manifest_for_cwd;
 
 #[derive(RustcDecodable)]
 struct Options {
@@ -38,8 +37,7 @@ crates to be locked to any yanked version.
 
 pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
     shell.set_verbose(options.flag_verbose);
-    let root = try!(find_root_manifest_for_cwd(None));
-    try!(ops::yank(&root, shell,
+    try!(ops::yank(shell,
                    options.arg_crate,
                    options.flag_vers,
                    options.flag_token,
index b76415d570266d03888b1f801e2d89b541c2bc32..5a361dff63754fa385aa63b5569fe2fed7801afb 100644 (file)
@@ -304,8 +304,7 @@ pub fn modify_owners(shell: &mut MultiShell,
     Ok(())
 }
 
-pub fn yank(manifest_path: &Path,
-            shell: &mut MultiShell,
+pub fn yank(shell: &mut MultiShell,
             krate: Option<String>,
             version: Option<String>,
             token: Option<String>,
@@ -314,6 +313,7 @@ pub fn yank(manifest_path: &Path,
     let name = match krate {
         Some(name) => name,
         None => {
+            let manifest_path = try!(find_root_manifest_for_cwd(None));
             let mut src = try!(PathSource::for_path(&manifest_path.dir_path()));
             try!(src.update());
             let pkg = try!(src.get_root_package());
index 8be97e5e262b51b066ce486e1bb261612e39ec72..da639769dda65f23f1048d1e62f67e5a15e34f88 100644 (file)
@@ -3,7 +3,7 @@ use std::io::{USER_DIR};
 use std::io::fs::{mkdir_recursive, rmdir_recursive, PathExtensions};
 use rustc_serialize::{Encodable, Encoder};
 use url::Url;
-use git2::{mod, ObjectType};
+use git2::{self, ObjectType};
 
 use core::GitReference;
 use util::{CargoResult, ChainError, human, ToUrl, internal};